//
//  COCOAFANTableView.m
//  CocoaFan
//
//  Created by Chen Xianan on 2009-02-17.
//  Copyright 2009 realazy.org All rights reserved.
//
// subclass to remove selected row's background color

#import "COCOAFANTableView.h"


@implementation COCOAFANTableView

- (id)_highlightColorForCell:(NSCell *)cell
{
    return nil;
}

- (void)reloadData
{
	while ([[self subviews] count] > 0) {
		[[[self subviews] lastObject] removeFromSuperviewWithoutNeedingDisplay];
    }
	[super reloadData];
}

- (BOOL)selectPreviousRow
{
	NSInteger row = [self selectedRow];
	NSLog(@"row:%i", row);
	if (row == -1 || row == 0) return NO;
	[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row -1]
	  byExtendingSelection:NO];
	return YES;
}

- (BOOL)selectNextRow
{
	NSInteger row = [self selectedRow];
	NSInteger numRows = [self numberOfRows];
	if (row == -1 || row == numRows - 1) return NO;
	[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row + 1]
	  byExtendingSelection:NO];
	return YES;
}

@end
